<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      layout:decorate="~{admin/layout}">
<body>

<div class="content-wrap" layout:fragment="content">
    <main id="content" class="content" role="main">
        <ol class="breadcrumb">
            <li>苗木管理</li>
            <li class="active">苗木入库</li>
        </ol>
        <section class="widget">
            <header>
                <div class="widget-controls">
                    <a data-widgster="expand" title="Expand" href="#"><i class="glyphicon glyphicon-chevron-up"></i></a>
                    <a data-widgster="collapse" title="Collapse" href="#"><i class="glyphicon glyphicon-chevron-down"></i></a>
                    <a data-widgster="close" title="Close" href="#"><i class="glyphicon glyphicon-remove"></i></a>
                </div>
            </header>
            <div class="widget-body">
                <div class="mt">
                    <table id="datatable-table" class="table table-striped table-hover">
                        <thead>
                        <tr>
                            <th class="no-sort hidden-sm-down">苗木数量</th>
                            <th class="hidden-sm-down">位置</th>
                            <th class="hidden-sm-down">树种</th>
                            <th class="no-sort">胸径</th>
                            <th class="no-sort">高度</th>
                            <th class="no-sort">采购价格</th>
                            <shiro:hasAnyRoles name="admin,finance">
                                <th class="no-sort">是否付款</th>
                            </shiro:hasAnyRoles>
                            <th class="no-sort">入库时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr th:each="trees :${trees}">
                            <td th:text="${trees.number}"></td>
                            <td th:text="${trees.place}"></td>
                            <td th:text="${trees.treeSpecies}"></td>
                            <td class="check"  th:text="${trees.chestBreadth}"></td>
                            <td class="check"  th:text="${trees.height}"></td>
                            <td class="check"  th:text="${trees.price}"></td>
                            <shiro:hasAnyRoles name="admin,finance">
                                <td>
                                    <div th:switch="${trees.payment}">
                                        <span th:case=true>已付款</span>
                                        <a th:case=false th:href="@{/admin/tree/payment(tree_id=${trees.tree_id})}"><input type="button" value="确认付款"></a>
                                    </div>
                                </td>
                            </shiro:hasAnyRoles>
                            <td th:text="${trees.createtime}"></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </section>
        <script>
            checknumber();
            var isfirst=sessionStorage.getItem("isFirst");
            if(!isfirst){
                location.reload();
                sessionStorage.setItem("isFirst",true);
            }
        </script>
    </main>
</div>
</body>
</html>